package com.framework.common.message;

import com.framework.common.utils.QuickHelper;

public enum  MessageType{

    ERROR("error","-2", "错误"),
    NONE("none","-1", "未知"),
    SYSTEM("system","0", "系统内置"),

    TEXT("text","1", "文字"),
    IMAGE("image","2", "图像"),
    EMOJI("emoji","3", "表情"),
    VOICE("voice","4", "音频"),
    RED_PACKET("red_packet","5", "红包"),
    LOCATION("location","6", "位置"),


    RTC("rtc","3010","实时音视频"),
    RTC_REQUEST("rtc_request","30101", "实时音视频请求(主叫方)"),
    RTC_ACCEPT("rtc_accept","30102", "实时音视频接听(被叫方)"),
    RTC_REFUSE("rtc_refuse","30103", "实时音视频挂断(被叫方)"),
    RTC_CONFLICT("rtc_conflict","30104", "实时音视频占线"),
    RTC_CANCEL("rtc_cancel","30105", "实时音视频取消"),
    RTC_END("rtc_end","30106", "实时音视频任意一方挂断"),

    JOIN_ROOM("join_room","201", "进入直播聊天室"),
    QUIT_ROOM("quit_room","202", "退出直播聊天室"),

    JOIN_GROUP("join_group","203", "进入聊天组"),
    QUIT_GROUP("quit_group","204", "退出聊天组"),

    /**
     * 服务器链接成功
     */
    CONNECTED("connected","200", "服务器连接成功"),

    GIFT_SENDED_SUCCESS("gift_sended_success","301","发送礼物成功"),
    GIFT_NEW_NOTICE("gift_new_notice","302","礼物赠送通知"),



    /**
     *　redis 代理存储并由服务端的web管理客户端处理的消息
     */
    REDIS_PROXY_MESSAGE("redis_proxy_message","901","redis_proxy_message"),
    REDIS_PROXY_MESSAGE_NEW_GIFT_EVENT("redis_proxy_message_new_gift_event","902","用户聊天室发送礼物"),
    REDIS_PROXY_MESSAGE_NEW_P2P_GIFT_EVENT("redis_proxy_message_new_p2p_gift_event","903","用户私聊礼物"),

    ;

    private String name;
    private String code;
    private String desc;

    MessageType(String name,String code, String desc) {
        this.name = name;
        this.code = code;
        this.desc = desc;
    }

    @Override
    public String toString(){
        return super.toString().toLowerCase();
    }

    public static MessageType valueOfName(String name) {
        for (MessageType item : values()) {
            if (item.toString().equalsIgnoreCase(name)) {
                return item;
            }
        }
        return MessageType.NONE;
    }

}